package bid

import (
	"errors"
	"wx-api/adx-bid/models/bid/BidModel"
)

func GetBudgetNewObjFast(p *BudgetService) (data []byte, hd map[string]string, surl, method string, tms int, err error) {
	switch p.Dsp.ApiType {
	case "360ad":
		data, hd, surl, method, tms, err = new(Ad360).Req(p)
		return
	case "huayan":
		data, hd, surl, method, tms, err = new(DHuayan).Req(p)
		return
	}
	return nil, nil, "", "", 300, errors.New("dsp is fast err:" + p.Dsp.ApiType)
}

func DecBudgetNewObjFast(p *BudgetService, robj ReqResult) (bid *BidModel.BidResponse_SeatBid_Bid, err error) {
	switch p.Dsp.ApiType {
	case "360ad":
		bid, err = new(Ad360).Res(p, robj.Data)
		return
	case "huayan":
		bid, err = new(DHuayan).Res(p, robj.Data)
		return
	}
	return nil, errors.New("res is nil")
}
